package top.frsf.reggie.common;

/**
 * @Author FRSF
 * @Date 2023/1/12 23:01
 * @Description 基于ThreadLocal封装的工具类，用于获取当前登录用户ID
 */
public class BaseContext {

    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();


    /**
     * @Author: FRSF
     * @Date: 2023/1/12 23:11
     * @Description 设置当前线程empId
     * @param id:
     * @return: void
     */
    public  static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    /**
     * @Author: FRSF
     * @Date: 2023/1/12 23:12
     * @Description 获取当前线程empId
     * @return: java.lang.Long
     */

    public static Long getCurrentId() {
        return threadLocal.get();
    }

}
